package com.example.helloworld;

        import androidx.appcompat.app.AppCompatActivity;

        import android.os.Bundle;

//import android.support.v7.app.AppCompatActivity;
        import android.util.Log;
        import android.view.View;
        import android.widget.Button;
        import android.widget.TextView;


public class MainActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Button btn1 = findViewById(R.id.button1);
        final TextView tv1 = findViewById(R.id.textView1);

        btn1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v){
                Log.d("123:","按钮被按了！");
                tv1.setText("*虚惊一场*");
            }
        });
    }
}
